/**
 * Created by Ren on 2015/5/5.
 */
// 加载dataType
var fs=require('fs');
// console.log(fs.readFileSync("Commonjs/dataType.js")+'');
eval(fs.readFileSync("../Commonjs/dataType.js")+'');

console.log(draw_Message.startX);

var ws = require("websocket-server");
var server = ws.createServer();
var connIDS = [];   // 连接的ID号
server.addListener("connection", function(connection){
    system_Message.content="Welcome， 当前人数："+server.manager.length;
    server.broadcast(JSON.stringify(system_Message));
    console.log(system_Message.content);
    connIDS.push(connection.id);
    if(connIDS.length==1)
    {
        token_Message.hasToken = true;
        server.send(connIDS[0],JSON.stringify(token_Message));
    }
    connection.addListener("message", function(msg){
        console.log(msg);
        server.broadcast(msg);
/*      server.broadcast("用户"+connection.id+"说："+msg)*/
    });
});
server.listen(6999);
console.log("My WebSocket Server is running");
